Set Generic Class

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Set<T> is a collection that contains items of type T. The item are maintained in a haphazard, unpredictable order, and duplicate items are not allowed.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
[SerializableAttribute]
public class Set<T> : CollectionBase<T>, ICollection<T>, 
	IEnumerable<T>, IEnumerable, ICloneable
Visual Basic (Declaration)
<SerializableAttribute> _
Public Class Set(Of T) _
	Inherits CollectionBase(Of T) _
	Implements ICollection(Of T), IEnumerable(Of T),  _
	IEnumerable, ICloneable
Visual C++
[SerializableAttribute]
generic<typename T>
public ref class Set : public CollectionBase<T>, 
	ICollection<T>, IEnumerable<T>, IEnumerable, ICloneable

Type Parameters

T

Remarks

The items are compared in one of two ways. If T implements IComparable<T> then the Equals method of that interface will be used to compare items, otherwise the Equals method from Object will be used. Alternatively, an instance of IComparer<T> can be passed to the constructor to use to compare items.

Set is implemented as a hash table. Inserting, deleting, and looking up an an element all are done in approximately constant time, regardless of the number of items in the Set.

OrderedSet<(Of <T>)> is similar, but uses comparison instead of hashing, and does maintains the items in sorted order.

Inheritance Hierarchy

System..::Object
  Wintellect.PowerCollections..::CollectionBase<(Of <T>)>
    Wintellect.PowerCollections..::Set<(Of <T>)>

See Also